<template>
  <div class="tabbar">
    <template v-for="(item, index) in tabs" :key="item">
      <div class="tab" @click="$emit('tabClick', index)">
        <span :class="{ active: index == currentIndex }">{{ item }}</span>
      </div>
    </template>
    <h2>{{ ddx }}</h2>
  </div>
</template>
<script>

export default {
  props: ['tabs', 'currentIndex'],
  emits: ['tabClick'],
  data() {
    return {
      // currentIndex: 0
    }
  },
  methods: {
    tabChange(index) {
      this.$emit('tabClick', index)
    }
  }
}
</script>

<style scoped>
.tabbar {
  width: 300px;
  margin: 0 auto;
  display: flex;
  cursor: pointer;
  text-align: center;
}

.tab {
  flex: 1;
}

.active {
  border-bottom: 2px solid red;
}
</style>